package cas;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author Aug28-tlsjn
 * @date 2021-04-11 Sunday 18:52
 */
public class CASDemo {
  public static void main(String[] args) {
    AtomicInteger atomicInteger = new AtomicInteger(5);
    System.out.println(atomicInteger.compareAndSet(5, 2021) + "\t current data: " + atomicInteger.get());
    System.out.println(atomicInteger.compareAndSet(5, 1024) + "\t current data: " + atomicInteger.get());
  }
}
